package cn.yuanqiao.web.controller.archive.wenjianzhengli;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.yuanqiao.common.annotation.Log;
import cn.yuanqiao.common.enums.BusinessType;

import cn.yuanqiao.archive.wenjianzhengli.domain.ConversionRules;
import cn.yuanqiao.archive.wenjianzhengli.service.IConversionRulesService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.utils.poi.ExcelUtil;
import cn.yuanqiao.common.web.page.TableDataInfo;

/**
 * 转换规则Controller
 * 
 * @author xy
 * @date 2024-01-17
 */
@RestController
@RequestMapping("/archive/conversionRules")
public class ConversionRulesController extends BaseController
{
    @Autowired
    private IConversionRulesService conversionRulesService;

    /**
     * 查询转换规则列表
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:gszh:list')")
*/
    @PreAuthorize("@ss.hasPermi('archive:gszh:list')")
    @GetMapping("/list")
    public TableDataInfo list(ConversionRules conversionRules)
    {
        startPage();
        List<ConversionRules> list = conversionRulesService.selectConversionRulesList(conversionRules);
        return getDataTable(list);
    }

    /**
     * 导出转换规则列表
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConversionRules:export')")
*/
    @Log(title = "转换规则", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ConversionRules conversionRules)
    {
        List<ConversionRules> list = conversionRulesService.selectConversionRulesList(conversionRules);
        ExcelUtil<ConversionRules> util = new ExcelUtil<ConversionRules>(ConversionRules.class);
        util.exportExcel(response, list, "转换规则数据");
    }

    /**
     * 获取转换规则详细信息
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConversionRules:query')")
*/
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(conversionRulesService.selectConversionRulesById(id));
    }

    /**
     * 新增转换规则
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConversionRules:add')")
*/
    @PreAuthorize("@ss.hasPermi('archive:gszh:add')")
    @Log(title = "转换规则", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ConversionRules conversionRules)
    {
        return toAjax(conversionRulesService.insertConversionRules(conversionRules));
    }

    /**
     * 修改转换规则
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConversionRules:edit')")
*/
    @PreAuthorize("@ss.hasPermi('archive:gszh:update')")
    @Log(title = "转换规则", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ConversionRules conversionRules)
    {
        return toAjax(conversionRulesService.updateConversionRules(conversionRules));
    }

    /**
     * 删除转换规则
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConversionRules:remove')")
*/
    @PreAuthorize("@ss.hasPermi('archive:gszh:delete')")
    @Log(title = "转换规则", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(conversionRulesService.deleteConversionRulesByIds(ids));
    }
}
